# -*- coding: utf-8 -*-
# @Time    : 2019/4/22 15:42
# @Author  : hyy
# @Email   : 1554148540@qq.com
# @File    : lea_3.py
# @Software: PyCharm
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
html = urlopen("http://en.wikipedia.org/wiki/Kevin_Bacon")
bsObj = BeautifulSoup(html)
for link in bsObj.find("div", {"id":"bodyContent"}).findAll("a",
                        href=re.compile("^(/wiki/)((?!:).)*$")):
    if 'href' in link.attrs:
        print(link.attrs['href'])